/*
* Copyright (c) 2008 Matt Giger http://earthbrowser.com/
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/

/**
* OpenStreetMapLayer
*
* Create a layer using the OpenStreetMap tiles.
*/
function OpenStreetMapLayer(plugin, params)
{
	// Default OpenStreetMap settings
	var layer_params = {
		isBaseLayer:true,
		isMercator:true,
		tileSize:256,
		numZoomLevels:22,
		base:"http://globe.earthbrowser.com/images/openstreetmap_base.png",
		template:[
			"http://tile.openstreetmap.org/{Z}/{X}/{Y}.png",
			"http://a.tile.openstreetmap.org/{Z}/{X}/{Y}.png",
			"http://b.tile.openstreetmap.org/{Z}/{X}/{Y}.png",
			"http://c.tile.openstreetmap.org/{Z}/{X}/{Y}.png"
		]
	};
	
	// override any default parameters
	if(params != undefined)
		for(var i in params)
			layer_params[i] = params[i];
	
	// pass back a TemplateLayer
	return new plugin.TemplateLayer(layer_params);
}
/**
* OpenStreetMapOsmaLayer
*
* Create a layer using the OpenStreetMap tiles.
*/
function OpenStreetMapOsmaLayer(plugin, params)
{
	// OpenStreetMap settings with Osmarender tiles
	var layer_params = {
		isBaseLayer:true,
		isMercator:true,
		tileSize:256,
		numZoomLevels:22,
		base:"http://globe.earthbrowser.com/images/openstreetmap_base.png",
		template:[
			"http://a.tah.openstreetmap.org/Tiles/tile/{Z}/{X}/{Y}.png",
			"http://b.tah.openstreetmap.org/Tiles/tile/{Z}/{X}/{Y}.png",
			"http://c.tah.openstreetmap.org/Tiles/tile/{Z}/{X}/{Y}.png",
			"http://d.tah.openstreetmap.org/Tiles/tile/{Z}/{X}/{Y}.png",
			"http://e.tah.openstreetmap.org/Tiles/tile/{Z}/{X}/{Y}.png",
			"http://f.tah.openstreetmap.org/Tiles/tile/{Z}/{X}/{Y}.png"
		]
	};
	
	// override any default parameters
	if(params != undefined)
		for(var i in params)
			layer_params[i] = params[i];
	
	// pass back a TemplateLayer
	return new plugin.TemplateLayer(layer_params);
}
